<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>新增新闻</title>
    <link rel="stylesheet" href="../../layui/css/layui.css">
    <link rel="stylesheet" href="../../css/view.css">
</head>
<body>
<h1 class="text-center" style="margin: 15px;font-size: 25px">新增新闻</h1>
<form class="layui-form" action="">
    <div class="layui-form-item">
        <label class="layui-form-label">标签：</label>
        <div class="layui-input-block">
            <input type="text" name="title" required  lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">标签：</label>
        <div class="layui-input-block">
            <button type="button" class="layui-btn" id="test1">
                <i class="layui-icon">&#xe67c;</i>上传图片
            </button>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">内容：</label>
        <div class="layui-input-block">
            <textarea id="edit" style="display: none;"></textarea>
        </div>

    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-input-block">
            <button class="layui-btn">保存</button>
        </div>
    </div>
</form>

<script src="../../layui/layui.js"></script>
<script>
    layui.use(['laypage','upload','layedit'], function(){
        var laypage = layui.laypage;
        var upload = layui.upload;
        var layedit = layui.layedit;

        //翻页
        laypage.render({
            elem: 'page',
            count: 50
        });

        //文件上传
        var uploadInst = upload.render({
            elem: '#test1' //绑定元素
            ,url: '/upload/' //上传接口
            ,done: function(res){
                //上传完毕回调
            }
            ,error: function(){
                //请求异常回调
            }
        });
        //富文本
        layedit.build('edit'); //建立编辑器
    });
</script>
</body>
</html>